﻿using Model;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DAL
{
    public class ClientDAL: PageDAL<ClientModel>
    {
        public ClientModel GetModelByID(string tableName, int pid)
        {
            string sql = $"select * from  {tableName} where id='{pid}'";
            DataTable dt = new DBHelper().GetDataTable(sql);
           ClientModel model = new ClientModel()
            {
                ID = int.Parse(dt.Rows[0]["id"].ToString()),
                Name = dt.Rows[0]["Name"].ToString(),
                Sex = dt.Rows[0]["Sex"].ToString(),
                   Address = dt.Rows[0]["Address"].ToString(),
               Call = dt.Rows[0]["Call"].ToString(),
                 AB = dt.Rows[0]["Ab"].ToString()

           };
            return model;
        }
    }
}
